﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Text;

using XianShang.Data;
using XianShang.Common;
using XianShang.Entity;
using XianShang.Data.DataProvider;

namespace XianShang.Data.DataProvider
{
    public class SwapCard
    {
        /// <summary>
        /// 在換卡主表中插入一條新數據并返回自增ID值
        /// </summary>
        /// <param name="csInfo"></param>
        /// <returns></returns>
        public static long AddNewCardSwap(CardSwapInfo csInfo)
        {
            return DatabaseProvider.GetInstance().AddNewCardSwap(csInfo);
        }
        /// <summary>
        /// 新增一條數據到（换卡子表_卡片訊息）CardInfo
        /// </summary>
        /// <param name="cInfo"></param>
        /// <returns></returns>
        public static int AddNewCardInfo(CardInfo cInfo)
        {
            return DatabaseProvider.GetInstance().AddNewCardInfo(cInfo);
        }
        /// <summary>
        /// 新增一條數據到（换卡子表_帳號數量）CardAccount
        /// </summary>
        /// <param name="caInfo"></param>
        /// <returns></returns>
        public static int AddNewCardAccount(CardAccountInfo caInfo)
        {
            return DatabaseProvider.GetInstance().AddNewCardAccount(caInfo);
        }
        /// <summary>
        /// 查詢換卡狀態信息
        /// </summary>
        /// <param name="name"></param>
        /// <param name="tel"></param>
        /// <param name="gameAccount"></param>
        /// <param name="cardNum"></param>
        /// <returns></returns>
        public static DataSet GetSwapCardAndCardAccountAndCardInfo(string name, string tel, string gameAccount, string cardNum)
        {
            return DatabaseProvider.GetInstance().GetSwapCardAndCardAccountAndCardInfo(name, tel, gameAccount, cardNum);
        }
    
        /// <summary>
        /// 取得換卡列表
        /// <param name="pages">分頁大小</param>
        /// <param name="indexPage">索引頁</param>
        /// </summary>
        /// <returns></returns>
        public static DataTable GetAllSwapCardInfo(int pages, int indexPage)
        {
            return Utils.LoadDataRows(DatabaseProvider.GetInstance().GetAllSwapCardInfo(), pages, indexPage);
        }
             /// <summary>
        /// 取得換卡列表
        ///><param name="area">地區</param>
        /// <param name="pages">分頁大小</param>
        /// <param name="indexPage">索引頁</param>
        /// </summary>
        /// <returns></returns>
        public static DataTable GetAllSwapCardInfo(string area,int pages, int indexPage)
        {
            return Utils.LoadDataRows(DatabaseProvider.GetInstance().GetAllSwapCardInfo(area), pages, indexPage);
        }
        /// <summary>
        /// 取得換卡列表
        /// </summary>
        /// <returns></returns>
        public static DataTable GetAllSwapCardInfo()
        {
            return Utils.DrToDt(DatabaseProvider.GetInstance().GetAllSwapCardInfo());
        }
        /// <summary>
        /// 取得換卡列表
        /// </summary>
        /// <returns></returns>
        public static DataTable GetAllSwapCardInfo(string area)
        {
            return Utils.DrToDt(DatabaseProvider.GetInstance().GetAllSwapCardInfo(area));
        }
        /// <summary>
        /// 根據實體參數進行查詢
        /// </summary>
        /// <param name="fr"></param>
        /// <param name="SearchType"></param>
        /// <returns></returns>
        public static DataTable GetAllSwapCardAndChildTableInfo(FullCardSwapInfo fcs, int SearchType)
        {
            return Utils.DrToDt(DatabaseProvider.GetInstance().GetAllSwapCardAndChildTableInfo(fcs, SearchType));
        }
        /// <summary>
        /// 根據實體參數進行查詢
        /// </summary>
        /// <param name="fr"></param>
        /// <param name="SearchType"></param>
        /// <param name="pageSize">分頁大小</param>
        /// <param name="pageIndex">當前頁</param>
        /// <returns></returns>
        public static DataTable GetAllSwapCardAndChildTableInfo(FullCardSwapInfo fcs, int SearchType, int pageSize, int pageIndex)
        {
            return Utils.LoadDataRows(DatabaseProvider.GetInstance().GetAllSwapCardAndChildTableInfo(fcs, SearchType), pageSize, pageIndex);
        }
         /// <summary>
        /// 根據實體參數和查找方式查找內容
        /// </summary>
        /// <param name="fcs"></param>
        /// <param name="SearchType">查找方式</param>
        /// <returns></returns>
        public static DataTable GetAllSwapCardAndChildTableByStatusInfo(FullCardSwapInfo fcs, int SearchType)
        {
            return Utils.DrToDt(DatabaseProvider.GetInstance().GetAllSwapCardAndChildTableByStatusInfo(fcs,SearchType));
        }
        /// <summary>
        /// 根據實體參數和查找方式查找內容
        /// </summary>
        /// <param name="fcs"></param>
        /// <param name="SearchType">查找方式</param>
        /// <param name="pageSize">分頁大小</param>
        /// <param name="pageIndex">當前頁</param>
        /// <returns></returns>
        public static DataTable GetAllSwapCardAndChildTableByStatusInfo(FullCardSwapInfo fcs, int SearchType, int pageSize, int pageIndex)
        {
            return Utils.LoadDataRows(DatabaseProvider.GetInstance().GetAllSwapCardAndChildTableByStatusInfo(fcs, SearchType),pageSize,pageIndex);
        }
        /// <summary>
        /// 更新Message ProcessIp Status ProcessTime四個字段
        /// </summary>
        /// <param name="cs"></param>
        /// <returns></returns>
        public static int UpSwapCardMessageProcessIpStatusProcessTime(CardSwapInfo cs)
        {
            return DatabaseProvider.GetInstance().UpSwapCardMessageProcessIpStatusProcessTime(cs);
        }
        /// <summary>
        /// 更新 ProcessIp Status ProcessTime三個字段
        /// </summary>
        /// <param name="cs"></param>
        /// <returns></returns>
        public static int UpSwapCardStatusProcessTimeProcessIpById(CardSwapInfo cs)
        {
            return DatabaseProvider.GetInstance().UpSwapCardStatusProcessTimeProcessIpById(cs);
        }
        /// <summary>
        /// 刪除換卡信息包括子表
        /// </summary>
        /// <param name="swapcardid"></param>
        /// <returns></returns>
        public static int DelSwapCardAndChildTableBySwapCardId(string swapcardid)
        {
            return DatabaseProvider.GetInstance().DelSwapCardAndChildTableBySwapCardId(swapcardid);
        }
        /// <summary>
        /// 根據ID取得換卡信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static DataTable GetSwapCardById(string id)
        {
            return DatabaseProvider.GetInstance().GetSwapCardById(id);
        }
        /// <summary>
        /// 取得換卡主表全部信息
        /// <param name="pageSize">分頁大小</param>
        /// <param name="pageIndex">當前頁</param>
        /// </summary>
        /// <returns></returns>
        public static DataTable GetAllMainSwapCardInfo(int pageSize, int pageIndex)
        {
            return Utils.LoadDataRows(DatabaseProvider.GetInstance().GetAllMainSwapCardInfo(), pageSize, pageIndex);
        }
        /// <summary>
        /// 取得換卡主表全部信息
        /// </summary>
        /// <returns></returns>
        public static DataTable GetAllMainSwapCardInfo()
        {
            return Utils.DrToDt(DatabaseProvider.GetInstance().GetAllMainSwapCardInfo());
        }
        /// <summary>
        /// 根據CARDSWAPID取得卡片信息
        /// </summary>
        /// <param name="swapcardid"></param>
        /// <returns></returns>
        public static DataTable GetCardInfoBySwapCardId(string swapcardid)
        {
           return DatabaseProvider.GetInstance().GetCardInfoBySwapCardId(swapcardid);
        }
        /// <summary>
        /// 根據CARDSWAPID取得換卡帳號信息
        /// </summary>
        /// <param name="swapcardid"></param>
        /// <returns></returns>
        public static DataTable GetCardAccountBySwapCardId(string swapcardid)
        {
            return DatabaseProvider.GetInstance().GetCardAccountBySwapCardId(swapcardid);
        }
        /// <summary>
        /// 根據主表ID取得主表和關聯字表信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static DataTable GetCardSwapAndChildById(string id)
        {
            return DatabaseProvider.GetInstance().GetCardSwapAndChildById(id);
        }
        /// <summary>
        /// 根據ID取得換卡主表信息
        /// </summary>
        /// <returns></returns>
        public static DataTable GetMainSwapCardInfo(string id)
        {
            return DatabaseProvider.GetInstance().GetMainSwapCardInfo(id);
        }
    }
}
